
@php
    use YmPhp\Admin\Services\ModuleServices;
    $url = $_SERVER['REQUEST_URI'];
    $urlComponents = parse_url($url);
    $parts = explode('/', $urlComponents['path']);
@endphp
<div class="main-menu">
    <div class="main-menu-content">
        <aside class="main-sidebar sidebar-light-primary @if($urlComponents['path'] == '/admin' ||  $urlComponents['path'] == '/admin/dashboard') @else menu-sidebar @endif" @if($urlComponents['path'] == '/admin' ||  $urlComponents['path'] == '/admin/dashboard')  style="margin-top: 0" @else style="margin-top: 20px" @endif>
            <div class="p-0 sidebar pb-3">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" >
                    {!! admin_section(YmPhp\Admin\Admin::SECTION['LEFT_SIDEBAR_MENU_TOP']) !!}
                    {!! admin_section(YmPhp\Admin\Admin::SECTION['LEFT_SIDEBAR_MENU']) !!}


                    {!! admin_section(YmPhp\Admin\Admin::SECTION['LEFT_SIDEBAR_MENU_BOTTOM']) !!}

{{--                    <li class="nav-item has-common-module">--}}
{{--                        <a id="openModalBtn" href="javascript:;" class="nav-link add-page ym-menu">--}}
{{--                            <i class="feather icon-grid"></i>--}}
{{--                            <p>模块</p>--}}
{{--                        </a>--}}
{{--                        <div class="modal-box" id="modules" style="display: none">--}}
{{--                            <s class="modal-dire" style=""></s>--}}
{{--                            <div class="modal-content">--}}
{{--                                <div class="module-title">全部模块</div>--}}
{{--                                <ul>--}}
{{--                                    @foreach((new ModuleServices())->getModules() as $module)--}}
{{--                                        <li class="item">--}}
{{--                                            <a class="nav-link add-page" data-id="1" data-name="模块管理" href="module/{{$module['name']}}">--}}
{{--                                                <img class="modal-img" src="/static/images/module/icon/{{$module['name']}}.png" alt="">--}}
{{--                                                <span>{{$module['title']}}</span>--}}
{{--                                            </a>--}}
{{--                                        </li>--}}
{{--                                    @endforeach--}}
{{--                                </ul>--}}
{{--                            </div>--}}
{{--                        </div>--}}
{{--                    </li>--}}
                </ul>
                <div class="aside-version">
                    <span class="current-version" title="点击检查新版本">版本：v{{ YmPhp\Admin\Admin::VERSION }}</span>
                </div>
            </div>
        </aside>
    </div>
</div>
<script>
    var modules = document.getElementById("modules");

    $("#openModalBtn").click(function(){
        modules.style.display = "block";
    });
    $("#modules_close").click(function(){
        modules.style.display = "none";
    });
    window.onclick = function(event) {
        if (event.target == modules) {
            modules.style.display = "none";
        }
    }
</script>
<style>
    .sidebar::-webkit-scrollbar {
        width: 0;
    }
    .sidebar::-webkit-scrollbar-track {
        background-color: transparent;
    }
    .sidebar::-webkit-scrollbar-thumb {
        background-color: transparent;
    }
     .modal-box {
         display: none;
         position: fixed;
         z-index: 999999;
         left: 0;
         top: 0;
         bottom: 0;
         width: 100%;
         height: 100%;
     }
    .modal-dire {
        position: fixed;
        width: 0;
        height: 0;
        bottom: 0;
        top: 51%;
        left: 80px;
        margin-left: 20px;
        border-right: 10px solid #ffffff;
        border-top: 10px solid transparent;
        border-bottom: 10px solid transparent;
        z-index: 9999999;
    }
    .has-common-module .modal-content {
        position: absolute;
        left: 110px;
        background-color: #fefefe;
        top: 34%;
        padding: 20px;
        width: 60%;
        height: 400px;
        overflow: auto;
        box-shadow: 0 0 20px 0 rgb(209 209 209)
    }
    .modal-content .module-title {
        line-height: 48px;
        font-weight: 800;
        font-size: 16px;
        color: #3c3c3c;
    }
    .modal-content ul {
        padding: 20px 0;
    }
    .modal-content .item{
        width: 100px;
        height: 140px;
    }
    .modal-content .item .nav-link:not(.active):hover {
        color: #409eff;
    }
    .modal-content .item span {
        line-height: 38px;
    }
    .modal-content .item .nav-link {
        display: flex;
        flex-direction: column;
        align-content: center;
        align-items: center;
    }
    .modal-content .item .modal-img{
        width: 60px;
        height: 60px;
    }
</style>
